
Page({

  /**
   * 页面的初始数据
   */
  data: {
    schema:[
    ],
    formData:{
    },
    title: '',
    result: '',
    remark: '',
    webUrl: '',
    apiName: ''
  },
  onLoad(options) {
    console.log('options', options)
    wx.setNavigationBarTitle({
      title: options.title,
    })
    
    this.setData({
      title: options.title,
      zh:options.zh,
      remark: options.remark,
      webUrl: options.webUrl
    })
    wx.onBeforeAppRoute(this.func)
  },
  getFormData(e) {
    
  },
  func(res) {
    const that = this;
    console.log(res, '====res');
    if (res.path === 'packageAPI/pages/route/rewrite-route/one-page') {
      console.log('res.path===one-page');
      wx.rewriteRoute({
        url: '/packageAPI/pages/route/rewrite-route/two-page',
        success(res) {
          console.info('Rewrite successfully from A to B')
          that.setData({
            result: res,
            apiName: 'wx.rewriteRoute'
          })
        },
        fail(res) {
          that.setData({
            result: res,
            apiName: 'wx.rewriteRoute'
          })
          console.error('Rewrite failed, reason: ' + res)
        }
      })
    }
  },
  choose1() {
    wx.navigateTo({
      url: '/packageAPI/pages/route/rewrite-route/one-page'
    })
  },
  onUnload() {
    wx.offBeforeAppRoute(this.func)
  }
})